﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Borg
{
    public class Document
    {
        private PlugInfo _plug;

        public virtual void OnCreated(object s, ExtensionEventArgs args)
        {
            _plug = args.ExtensionInfo.PlugInfos["Borg.Document"];
        }

        public List<IView> Views
        {
            get
            {
                var list = new List<IView>(_plug.PluggedInSlots.Count);

                list.AddRange(_plug.PluggedInSlots.
                    Select(slot => (IView)slot.ExtensionInfo.PlugInfos["Borg.View"].Object));

                return list;
            }
        }
    }

    public class DocumentChangedEventArgs : EventArgs
    {
        public object Hint;
        public IView Sender;
    }

    public delegate void DocumentChangedEventHandler(object sender, DocumentChangedEventArgs e);
}

